package postpic.app;

import org.json.JSONObject;

import postpic.app.io.ClientIO;
import postpic.domain.action.Action;
import postpic.domain.session.Request;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.TextView;

public class AddFriendActivity extends Activity implements OnClickListener{
	
	public void onCreate(Bundle savedInstanceState){
		super.onCreate(savedInstanceState);
	    setContentView(R.layout.addfriend);
	}
	public void onClick(View v) {
    	switch(v.getId()) {
    	case R.id.addButton:
    		JSONObject friendInfo = new JSONObject();
    		EditText emailAddr = (EditText)findViewById(R.id.emailAddr);
    		friendInfo.put("email", emailAddr.getText().toString());
    	    ClientIO.sendRequest(new Request(Action.ADD_FRIEND, friendInfo));
    	    Intent myIntent = new Intent(v.getContext(), PostPicActivity.class);
		    v.getContext().startActivity(myIntent);
    	}
	}
}
